package com.qyi.activemq.topic.producer;

import lombok.extern.slf4j.Slf4j;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.jms.ConnectionFactory;

/**
 * @author luqi
 * @Date 2021/3/11 10:07
 * @Description TODO
 */
@Service
@Slf4j
public class MqProducerService {

    @Autowired
    JmsMessagingTemplate jmsMessagingTemplate;

    public void sendTopic(String msg) {
        jmsMessagingTemplate.convertAndSend(new ActiveMQTopic("t1-topic"), msg);
    }

}
